'use strict';

const path = require('path');

module.exports = {
	common: {
		cache: {
			type: 'filesystem' // 使用文件缓存
		}
	},
	dev: {
		assetsPublicPath: '/',
		proxyTable: {
			'/api': {
				target: '',
				changeOrigin: true,
				pathRewrite: {
					'^/api': '/api'
				}
			}
		},

		// Various Dev Server settings
		host: 'localhost', //'localhost', // can be overwritten by process.env.HOST
		port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
		autoOpenBrowser: true,
		errorOverlay: true,
		notifyOnErrors: true,
		historyApiFallback: true,
		https: true,
		devtool: 'eval-cheap-module-source-map',
		cacheBusting: true,
		cssSourceMap: true
	},

	build: {
		// Paths
		assetsRoot: path.resolve(__dirname, '../dist'),
		assetsSubDirectory: '../',
		assetsPublicPath: './', //设置public路径---/ ./  client

		/**
		 * Source Maps
		 */

		productionSourceMap: false,
		// https://webpack.js.org/configuration/devtool/#production
		devtool: 'nosources-source-map',

		// Gzip off by default as many popular static hosts such as
		// Surge or Netlify already gzip all static assets for you.
		// Before setting to `true`, make sure to:
		// npm install --save-dev compression-webpack-plugin
		productionGzip: false,
		productionGzipExtensions: ['js', 'css'],
		bundleAnalyzerReport: process.env.npm_config_report
	}
};
